package com.hfad.todolistapp.service;

import android.content.Context;
import android.graphics.drawable.Drawable;

import androidx.core.content.ContextCompat;

import com.hfad.todolistapp.R;
import com.hfad.todolistapp.model.TodoItem;

public class StatusService {
    public static Drawable getStatusDrawable(Context context, TodoItem.ItemStatus status) {
        int statusResId = R.drawable.ic_status_todo;
        if (status == TodoItem.ItemStatus.IN_PROGRESS) {
            statusResId = R.drawable.ic_status_in_progress;
        } else if (status == TodoItem.ItemStatus.COMPLETE) {
            statusResId = R.drawable.ic_status_complete;
        }
        return ContextCompat.getDrawable(context, statusResId);
    }

    public static String getStatusText(Context context, TodoItem.ItemStatus status) {
        int resId = R.string.status_todo;
        if (status == TodoItem.ItemStatus.IN_PROGRESS) {
            resId = R.string.status_in_progress;
        } else if (status == TodoItem.ItemStatus.COMPLETE) {
            resId = R.string.status_complete;
        }
        return context.getResources().getString(resId);
    }
}
